package com.tfswx.jcyw.sqlmodel.api.util;

import com.tfswx.jcyw.sqlmodel.api.SqlModelFactory;

import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * @author 张述江
 * @date 2023/9/13
 */
public class ClassUtil {

    public static <T> List<T> getList(Set<Class<T>> tClassSet) {
        return tClassSet.stream().map(ClassUtil::getObj).collect(Collectors.toList());
    }

    public static <T> T getObj(Class<T> tClass) {
        try {
            return tClass.newInstance();
        } catch (InstantiationException | IllegalAccessException e) {
            throw new RuntimeException(e);
        }
    }
}
